﻿using DongFangGuoKai.WMSPlatform.Domain.Enums;
using DongFangGuoKai.WMSPlatform.Service.LogApp;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using DongFangGuoKai.WMSPlatform.Commn.Tools;  

namespace DongFangGuoKai.WMSPlatform.WebApi.Controllers.BasicData
{
    /// <summary>
    /// 接口日志
    /// </summary>
    [Route("api/[controller]")]
    [ApiController]
    public class InterfaceLogSearchController : ApiBaseController
    {
        public InterfaceLogSearchController(ILogService logService)
        {
            LogService = logService;
        }
        public ILogService LogService { get; }


        [HttpGet]
        [Route("GetList")]
        public IActionResult GetList(EmInterfaceLogType? type, int? status, string? keyWords, int pageIndex = 1, int pageSize = 50)
        {
            var data = LogService.GetInterfaceLogList(pageIndex, pageSize, type, status, keyWords);
            return Success(data);
        }

        [HttpGet]
        [Route("GetLogTypeSelectData")]
        public IActionResult GetLogTypeSelectData()
        {
            var data = typeof(EmInterfaceLogType).ToDictionary().Select(kv => new { Id = kv.Key, Name = kv.Value }).ToList();
            return Success(data);
        }
    }
}
